package blog.action;

import java.util.Date;

import blog.entity.Blog;
import blog.entity.User;
import blog.util.MyActionSupport;

public class BlogAction extends MyActionSupport {
	public String addBlog(){
		blog = new Blog();
		blog.setCateId(1);
		blog.setContent(content);
		blog.setPubdate(new Date());
		blog.setReplies(0);
		blog.setTitle("title");
		User user = new User();
		user.setUsername("tiger");
		user.setPassword("9394");
		user.setPortrait(new byte[10]);
		blog.setUser(user);
		this.getUserService().saveUser(user);
		this.getBlogService().saveBlog(blog);
		return SUCCESS;
	}
	
	private static final long serialVersionUID = 1L;
	private Blog blog;
	private int blogId;
	private int cateId;// 博客分类ID
	private String title;// 博客标题
	private String content;// 博客内容
	private User user;// 发表用户ID
	private Date pubdate;// 发表时间
	private int replies;// 评论数
	
	public Blog getBlog() {
		return blog;
	}

	public void setBlog(Blog blog) {
		this.blog = blog;
	}

	public int getBlogId() {
		return blogId;
	}

	public void setBlogId(int blogId) {
		this.blogId = blogId;
	}

	public int getCateId() {
		return cateId;
	}

	public void setCateId(int cateId) {
		this.cateId = cateId;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Date getPubdate() {
		return pubdate;
	}

	public void setPubdate(Date pubdate) {
		this.pubdate = pubdate;
	}

	public int getReplies() {
		return replies;
	}

	public void setReplies(int replies) {
		this.replies = replies;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}
}
